package com.example.yuejian.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.yuejian.Adapter.ClublistAdapter;
import com.example.yuejian.Bean.Club;
import com.example.yuejian.R;
import com.example.yuejian.listener.ClubListener;
import com.example.yuejian.model.ClubModel;

import java.util.List;




public class ClubFragment extends Fragment implements ClubListener<Club> {
    View v;
    RecyclerView recyclerView_clublist;
    ClublistAdapter adapter;
    @Override
    public View onCreateView(LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState)
    {
        v = inflater.inflate(R.layout.club, null) ;
        recyclerView_clublist = (RecyclerView)v.findViewById(R.id.recyclerView_clublist);
        recyclerView_clublist.setLayoutManager(new LinearLayoutManager(getActivity()));
        ClubModel clubModel = new ClubModel();
        clubModel.clubData(this);
        return v ;
    }


    @Override
    public void onResponse(Club club) {
        List<Club.ClublistBean> clublistBeen = club.getClublist();
        ClublistAdapter adapter = new ClublistAdapter(getActivity(),clublistBeen);
        recyclerView_clublist.setAdapter(adapter);
    }

    @Override
    public void onFail(String msg) {
        System.out.println("+++++"+"失败率");
    }
}
